com.highdeal.pnr.hci
Class PricePlanModel

java.lang.Object
  extended by com.highdeal.pnr.hci.PricePlanModel
All Implemented Interfaces:
XMLMarshallable, ContextualNode

public class PricePlanModel
extends java.lang.Object
implements XMLMarshallable, ContextualNode

This class represents a price plan.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="pricePlan">
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="counterDescription" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="usage" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="oneShot" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="recurring" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element ref="chargingPlan" minOccurs="0" maxOccurs="1"/>
     </xs:sequence>
     <xs:attribute name="name" type="xs:string"/>
     <xs:attribute name="description" type="xs:string"/>
     <xs:attribute name="freeText" type="xs:string"/>
     <xs:attribute name="currency" type="xs:string" use="optional"/> <!-- deprecated -->
   </xs:complexType>
 </xs:element>


Constructor Summary
PricePlanModel()
          Builds an empty PricePlanModel.
PricePlanModel(java.lang.String name, java.lang.String description, java.lang.String text, java.lang.String currencyCode)
          Builds a PricePlanModel.
 
Method Summary
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String name, XMLMarshallable child)
          Adds a child to the object, the child representing the marshallable object which must be added to the element.
 void addOneShotRate(OneShotRateModel rate)
          Adds a one shot rate.
 void addOneShotRates(java.util.Vector<OneShotRateModel> oneShotRates)
          Adds one shot rates.
 void addRecurringRate(RecurringRateModel rate)
          Adds a recurring rate.
 void addRecurringRates(java.util.Vector<RecurringRateModel> recurringRates)
          Adds recurring rates.
 void addUsageRate(UsageRateModel rate)
          Adds an usage rate.
 void addUsageRates(java.util.Vector<UsageRateModel> usageRates)
          Adds usage rates.
 void checkChargingPlanCompatibility()
          Check if the charging plan is compatible with this price plan.
 boolean checkValidity()
          Returns true if the price plan is valid.
 java.util.Vector<CounterDescriptionModel> createCounterDescriptions()
          Creates the counter descriptions including persistent and transient counters.
static void findLeaves(RateComponentModel component, java.util.List<RateComponentModel> leaves)
          Fill the given list with all leaves starting from the given rate component.
 ChargingPlanModel getChargingPlan()
          Gets the charging plan.
 ChargingPlanDictionaryModel getChargingPlanDictionaryModel()
           
 RatingContextDescription getContext(ContextualNode child)
          Updates the context for the specified child and returns it.
 java.lang.String getCurrencyCode()
          Deprecated. Use ChargeComponentModel.getCurrencyCode().
 java.lang.String getDescription()
          Gets the description.
 java.lang.String getFreeText()
          Gets the free text.
 java.lang.String getName()
          Gets the name.
 OneShotRateModel getOneShotRate(int index)
          Gets a one shot rate.
 java.util.Vector<OneShotRateModel> getOneShotRates()
          Gets one shot rates.
 java.util.Vector<ParameterModel> getParameters()
          Gets the parameters.
 java.util.Vector<CounterDescriptionModel> getPersistentCounterDescriptions()
          Gets the persistent counter descriptions.
 java.util.Vector<ProductModel> getProducts()
          Gets the products.
 RecurringRateModel getRecurringRate(int index)
          Gets a recurring rate.
 java.util.Vector<RecurringRateModel> getRecurringRates()
          Gets the recurring rates.
 java.util.Vector<CounterDescriptionModel> getTransientCounterDescriptions()
          Gets the transient counter descriptions.
 UsageRateModel getUsageRate(int index)
          Gets an usage rate at a specified index.
 java.util.Vector<UsageRateModel> getUsageRates()
          Gets the usage rates.
 RatingContextDescription inheritedContext()
          Gets the inherited context.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 void removeOneShotRate(int index)
          Removes a one shot rate.
 void removeRecurringRate(int index)
          Removes a recurring rate.
 void removeUsageRate(int index)
          Removes an usage rate.
 java.util.Vector<PropertyDescriptionModel> retrieveAllProperties()
          Returns all the properties of this price plan.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 void setChargingPlan(ChargingPlanModel chargingPlan)
          Sets the charging plan.
 void setChargingPlanDictionaryModel(ChargingPlanDictionaryModel chargingPlanDictionaryModel)
           
 void setContext(RatingContextDescription contextDescription)
          Sets the context.
 void setCurrencyCode(java.lang.String currencyCode)
          Deprecated. Use ChargeComponentModel.setCurrencyCode(String).
 void setDescription(java.lang.String description)
          Sets the description.
 void setFreeText(java.lang.String text)
          Sets the free text.
 void setName(java.lang.String name)
          Sets the name.
 void setParameters(java.util.Vector<ParameterModel> p)
          Sets the parameters.
 void setParent(ContextualNode node)
          Sets the parent.
 void setPersistentCounterDescriptions(java.util.Vector<CounterDescriptionModel> counterDescriptions)
          Sets the persistent counter descriptions.
 void setProducts(java.util.Vector<ProductModel> products)
          Sets the products.
 void setTransientCounterDescriptions(java.util.Vector<CounterDescriptionModel> counterDescriptions)
          Sets the transient counter descriptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PricePlanModel

public PricePlanModel()
Builds an empty PricePlanModel.


PricePlanModel

public PricePlanModel(java.lang.String name,
                      java.lang.String description,
                      java.lang.String text,
                      java.lang.String currencyCode)
Builds a PricePlanModel.

Parameters:
name - the name.
description - the description.
text - the free text.
currencyCode - the currency code.
Method Detail

setName

public void setName(java.lang.String name)
Sets the name.

Parameters:
name - the name.

getName

public java.lang.String getName()
Gets the name.

Returns:
the name.

setDescription

public void setDescription(java.lang.String description)
Sets the description.

Parameters:
description - the description.

getDescription

public java.lang.String getDescription()
Gets the description.

Returns:
the description.

setFreeText

public void setFreeText(java.lang.String text)
Sets the free text.

Parameters:
text - the free text.

getFreeText

public java.lang.String getFreeText()
Gets the free text.

Returns:
the free text.

setCurrencyCode

@Deprecated
public void setCurrencyCode(java.lang.String currencyCode)
Deprecated. Use ChargeComponentModel.setCurrencyCode(String).

Sets the currency code.

Parameters:
currencyCode - the currency code.

getCurrencyCode

@Deprecated
public java.lang.String getCurrencyCode()
Deprecated. Use ChargeComponentModel.getCurrencyCode().

Gets the currency code.

Returns:
the currency code.

setProducts

public void setProducts(java.util.Vector<ProductModel> products)
Sets the products.

Parameters:
products - a Vector of ProductModel.

getProducts

public java.util.Vector<ProductModel> getProducts()
Gets the products.

Returns:
a Vector of ProductModel.

createCounterDescriptions

public java.util.Vector<CounterDescriptionModel> createCounterDescriptions()
Creates the counter descriptions including persistent and transient counters.

Returns:
a Vector of CounterDescriptionModel.

setPersistentCounterDescriptions

public void setPersistentCounterDescriptions(java.util.Vector<CounterDescriptionModel> counterDescriptions)
Sets the persistent counter descriptions.

Parameters:
counterDescriptions - a Vector of CounterDescriptionModel.

getPersistentCounterDescriptions

public java.util.Vector<CounterDescriptionModel> getPersistentCounterDescriptions()
Gets the persistent counter descriptions.

Returns:
a Vector of CounterDescriptionModel.

setTransientCounterDescriptions

public void setTransientCounterDescriptions(java.util.Vector<CounterDescriptionModel> counterDescriptions)
Sets the transient counter descriptions.

Parameters:
counterDescriptions - a Vector of CounterDescriptionModel.

getTransientCounterDescriptions

public java.util.Vector<CounterDescriptionModel> getTransientCounterDescriptions()
Gets the transient counter descriptions.

Returns:
a Vector of CounterDescriptionModel.

getUsageRates

public java.util.Vector<UsageRateModel> getUsageRates()
Gets the usage rates. Do not use this to add or remove elements.

Returns:
a Vector of UsageRateModel.

addUsageRates

public void addUsageRates(java.util.Vector<UsageRateModel> usageRates)
Adds usage rates.

Parameters:
usageRates - a Vector of UsageRateModel.

addUsageRate

public void addUsageRate(UsageRateModel rate)
Adds an usage rate.

Parameters:
rate - the usage rate to add.

removeUsageRate

public void removeUsageRate(int index)
Removes an usage rate.

Parameters:
index - the index of the usage rate to be removed.

getUsageRate

public UsageRateModel getUsageRate(int index)
Gets an usage rate at a specified index.

Parameters:
index - the index of the usage rate to get.
Returns:
an usage rate at a specified index.

getRecurringRates

public java.util.Vector<RecurringRateModel> getRecurringRates()
Gets the recurring rates. Do not use this to add or remove elements.

Returns:
a Vector of RecurringRateModel.

addRecurringRates

public void addRecurringRates(java.util.Vector<RecurringRateModel> recurringRates)
Adds recurring rates.

Parameters:
recurringRates - a Vector of RecurringRateModel.

addRecurringRate

public void addRecurringRate(RecurringRateModel rate)
Adds a recurring rate.

Parameters:
rate - the recurring rate to add.

removeRecurringRate

public void removeRecurringRate(int index)
Removes a recurring rate.

Parameters:
index - the index of the recurring rate to be removed.

getRecurringRate

public RecurringRateModel getRecurringRate(int index)
Gets a recurring rate.

Parameters:
index - the index of the recurring rate to get.
Returns:
a recurring rate.

getOneShotRates

public java.util.Vector<OneShotRateModel> getOneShotRates()
Gets one shot rates. Do not use this to add or remove elements.

Returns:
a Vector of OneShotRateModel.

addOneShotRates

public void addOneShotRates(java.util.Vector<OneShotRateModel> oneShotRates)
Adds one shot rates.

Parameters:
oneShotRates - a Vector of OneShotRateModel.

addOneShotRate

public void addOneShotRate(OneShotRateModel rate)
Adds a one shot rate.

Parameters:
rate - the one shot rate to add.

removeOneShotRate

public void removeOneShotRate(int index)
Removes a one shot rate.

Parameters:
index - the index of the one shot rate to be removed.

getChargingPlan

public ChargingPlanModel getChargingPlan()
Gets the charging plan.

Returns:
the charging plan.

setChargingPlan

public void setChargingPlan(ChargingPlanModel chargingPlan)
Sets the charging plan.

Parameters:
chargingPlan -

checkChargingPlanCompatibility

public void checkChargingPlanCompatibility()
                                    throws InvalidInitializationException
Check if the charging plan is compatible with this price plan.

Throws:
InvalidInitializationException

setChargingPlanDictionaryModel

public void setChargingPlanDictionaryModel(ChargingPlanDictionaryModel chargingPlanDictionaryModel)

getChargingPlanDictionaryModel

public ChargingPlanDictionaryModel getChargingPlanDictionaryModel()

getOneShotRate

public OneShotRateModel getOneShotRate(int index)
Gets a one shot rate.

Parameters:
index - the index of the one shot rate to get.
Returns:
a one shot rate.

getParameters

public java.util.Vector<ParameterModel> getParameters()
Gets the parameters.

Returns:
a Vector of ParameterModel.

setParameters

public void setParameters(java.util.Vector<ParameterModel> p)
Sets the parameters.

Parameters:
p - a Vector of ParameterModel.

setParent

public void setParent(ContextualNode node)
Sets the parent.

Specified by:
setParent in interface ContextualNode
Parameters:
node - the parent (ignored).

getContext

public RatingContextDescription getContext(ContextualNode child)
Updates the context for the specified child and returns it.

Specified by:
getContext in interface ContextualNode
Parameters:
child -
Returns:
refreshed context.

inheritedContext

public RatingContextDescription inheritedContext()
Gets the inherited context.

Specified by:
inheritedContext in interface ContextualNode
Returns:
the inherited context.

setContext

public void setContext(RatingContextDescription contextDescription)
Sets the context.

Parameters:
contextDescription - the context.

checkValidity

public boolean checkValidity()
Returns true if the price plan is valid.

Returns:
true if the price plan is valid, false otherwise.

retrieveAllProperties

public java.util.Vector<PropertyDescriptionModel> retrieveAllProperties()
Returns all the properties of this price plan.

Returns:
a list of PropertyDescriptionModel that represents all the properties defined in this price plan.

setAttributes

public void setAttributes(XMLAttributes atts)
Description copied from interface: XMLMarshallable
Sets the attributes of the XML representation of the element being processed.

Specified by:
setAttributes in interface XMLMarshallable
Parameters:
atts - The XML attributes of the current element

addCharacterData

public void addCharacterData(java.lang.String cData)
Description copied from interface: XMLMarshallable
Adds character data to the content element.

Specified by:
addCharacterData in interface XMLMarshallable
Parameters:
cData - The character data to be added

addChild

public void addChild(java.lang.String name,
                     XMLMarshallable child)
Description copied from interface: XMLMarshallable
Adds a child to the object, the child representing the marshallable object which must be added to the element.

Specified by:
addChild in interface XMLMarshallable
Parameters:
name - The name of tag for the child
child - The child to be added

marshal

public void marshal(XMLOutputter output)
Description copied from interface: XMLMarshallable
Gives an XML representation of this object, including its children.

Specified by:
marshal in interface XMLMarshallable
Parameters:
output - The XML output to marshal the object into

findLeaves

public static final void findLeaves(RateComponentModel component,
                                    java.util.List<RateComponentModel> leaves)
Fill the given list with all leaves starting from the given rate component.

Parameters:
component - the rate component of the start.
leaves - the list of all leaves retreived.

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)